/**
 * ReportGear(2011)
 */
package com.reportgear.report.model.headerfooter;

import java.awt.Dimension;
import java.awt.geom.Dimension2D;

import javax.swing.Icon;

import org.dom4j.Element;

import com.reportgear.core.util.ImageUtils;
import com.reportgear.report.model.headerfooter.editor.ElementEditor;

/**
 * 页眉页脚元素-换行
 * 
 * @version 1.0 2011-4-23
 * @author <a herf="lexloo@gmail.com">lexloo</a>
 * @since Report 1.0
 */
public class NewLineHFElement extends AbstractHFElement {
	public Dimension2D getSize() {
		return new Dimension(0, 10);
	}

	@Override
	public String getCaption() {
		return "换行";
	}

	@Override
	public ElementEditor getEditor() {
		return null;
	}

	@Override
	public Icon getIcon() {
		return ImageUtils.readIcon("/resources/images/dialog/headerfooter/newLine.png");
	}

	@Override
	public NewLineHFElement read(Element parent) {
		return this;
	}

	@Override
	public void write(Element parent) {
		if (parent == null) {
			return;
		}

		Element el = parent.addElement(HFElement.XML_TAG_TYPE);
		el.addText(HFElement.TYPE_NEWLINE);
	}
}